capabilities
which determine
what a wallet can do and also what a dapp wants a wallet to do. This allows the
use of Paymasters, which are defined in ERC 7677.sendCalls
.
This means that before using sendCalls
, there needs to be a check on whether
the account is compatible or not. Thankfully, this can be achieved using
getCapabilities
.
An example custom hook that leverages Wagmi’s hooks for getCapabilities
can be
found
in our lab.
This hook is then used
also in our lab.
Essentially - the Wallet will inform the Dapp if it supports EIP 5792 or not.
Regardless of whether wagmi
or ethers
is used, once capabilities are
fetched, you can then check:
writeContractAsync
, switching to sendCalls
involves a minor change in encoding the call. An example of it in use can be
found
here.
Important to note is that the function call data is pre-encoded
on line 12
within the same file. This is the main difference as writeContractAsync
encodes the calls itself.
writeContractAsync
or similar calls, there would be a
waitForTransactionReceipt
used to wait for the transaction. Sending calls via
the EIP 5792 standards by design does not return a transaction hash by design.
Instead, sendCalls
will return an identifier for the transaction which can be
queried via getting the calls’ status. In Wagmi’s case, this is done using
useCallsStatus
.
An example can be found
in our lab.